package test;
import java.util.Scanner;
public class huiwen {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int l= chuli(s);
        System.out.println(l);
    }
    public static int chuli(String s){
        int max=0;
        for(int i=0;i<s.length();i++){
            int len1=panduan(s,i,i);
            int len2=panduan(s,i,i+1);
            if(max<len2||max<len1){
                if(len1>len2){
                    max=len1;
                }else {
                    max=len2;
                }
            }
        }
        return max;

    }
    public static int panduan(String s,int lift,int right){
        int len=0;
        while(lift>=0 && right<=s.length()-1 && s.charAt(lift)==s.charAt(right) ){
            lift--;
            right++;

        }
        return right-lift-1;
    }
}
